package leetCode;

public class 链表中倒数第k个节点 {
    public ListNode getKthFromEnd(ListNode head, int k) {
        ListNode first = head;
        ListNode later = head;
        for (int i = 0;i<k;i++){
            first = first.next;
        }
        while (first!=null){
            first = first.next;
            later = later.next;
        }
        return later;
    }
}
